package middlewares

import (
	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/limiter"
)

func Limiter(max int) func(c *fiber.Ctx) error {
	return limiter.New(limiter.Config{
		Max: max,
		KeyGenerator: func(c *fiber.Ctx) string {
			return c.IP() // 使用IP地址作为限制器的键
		},
	})
}
